Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pkg-conf

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pkg-conf

Get namespaced config from the closest package.json

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3M
increased by12.42%
Maintainers
1
Weekly downloads
 
Created

What is pkg-conf?

The pkg-conf npm package allows you to load configuration from the `package.json` file of your project. It helps in managing project-specific configurations in a centralized manner.

What are pkg-conf's main functionalities?

Load Configuration

This feature allows you to load configuration settings from the `package.json` file under a specific namespace (in this case, 'myApp'). The configuration is returned as a JavaScript object.

const pkgConf = require('pkg-conf');
(async () => {
  const config = await pkgConf('myApp');
  console.log(config);
})();

Default Values

You can provide default values for configuration settings. If the specified configuration is not found in the `package.json` file, the default values will be used.

const pkgConf = require('pkg-conf');
(async () => {
  const config = await pkgConf('myApp', { default: 'value' });
  console.log(config);
})();

Sync Loading

This feature allows you to load configuration settings synchronously. This can be useful in scenarios where asynchronous operations are not suitable.

const pkgConf = require('pkg-conf');
const config = pkgConf.sync('myApp');
console.log(config);

Other packages similar to pkg-conf

Keywords

FAQs

Package last updated on 06 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc